﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UCS.XNA.Utils;
using UCS.XNA.Utils.Animation;

namespace Hopeless.Physical
{
    class BloodSpill : ITranslateAnimatable, IScalable
    {
        public BloodSpill(int diameter)
        {
            _diameter = diameter;
        }

        private Rectangle _space;
        private Texture2D _texture;
        private int _diameter;

        private Vector2 _position;
        public Vector2 Position
        {
            get { return _position; }
            set
            {
                _position = value;
                this.InitializeSpace();
            }
        }

        private float _scale = 1f;
        public float Scale
        {
            get { return _scale; }
            set
            {
                _scale = value;
                this.InitializeSpace();
            }
        }

        private bool _falling = false;
        public bool Falling
        {
            get { return _falling; }
            set { _falling = value; }
        }

        public void Initialize()
        {
            _texture = GameResources.Content.Load<Texture2D>("Blood");
        }

        public void Draw(GameTime gameTime)
        {
            GameResources.SpriteBatch.Begin();
            GameResources.SpriteBatch.Draw(_texture, _space, null, Color.White, 0, new Vector2(_texture.Width / 2, _texture.Height / 2), SpriteEffects.None, 0);
            GameResources.SpriteBatch.End();
        }

        private void InitializeSpace()
        {
            _space = new Rectangle((int)_position.X, (int)_position.Y, (int)(_diameter * _scale), (int)(_diameter * _scale));
        }
    }
}
